#include <iostream>
#include<vector>
using namespace std;


const int N = 1e5 + 10;
vector<int> p[N];

int i, j ,k, n, q;

int main()
{
	cin >> n >> q;
	while(q--)
	{
		int op;
		cin >> op >> i >> j;
		if(op == 1)
		{
			cin >> k;
			if(p[i].size() <= j)
			    p[i].resize(j + 1);
			p[i][j] = k;
		}
		else
		{
			cout << p[i][j] << endl;
		}
	}
	return 0;
}
